package com.example.controller;

import com.csq.User;
import com.example.feignService.UserFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 接口传参
 *    1、基本数据类型：直接传参   @RequestParam("id") Integer id
 *    2、引用数据类型：JavaBean   @RequestBody  User user
 *    yw 82  s 73   yy 56  wl20   hx24  sw28     zong:
 */
@RestController
public class UserController {

    @Autowired
    private UserFeignService userFeignService;



    /**
     *
     * @return
     */
    @RequestMapping(value = "/get/{username}", method = RequestMethod.GET)
    public User get(@PathVariable("username") String username){
        User user = userFeignService.get(username);

        return user;
    }

    @RequestMapping("admin/hello")
    public Object admin(){

        return "admin hello";
    }

    @RequestMapping("user/hello")
    public Object user(){

        return "user hello";
    }

    @RequestMapping("hello")
    public Object hello(){

        return "hello";
    }

    @RequestMapping("db/hello")
    public Object db(){

        return "db hello";
    }
}
